import type { DictTypeDetailResult, DictTypeEntityReq, DictTypeListResult, DictTypePageReq } from "@/api/types";
import request from "@/utils/http";

function create(data: DictTypeEntityReq): Promise<Resp<string>> {
    return request({
        url: "/sys/dictType/create",
        method: "post",
        data,
    });
}

function remove(id: string): Promise<Resp<null>> {
    return request({
        url: "/sys/dictType/remove",
        method: "post",
        data: { id },
    });
}
function update(data: DictTypeEntityReq): Promise<Resp<null>> {
    return request({
        url: "/sys/dictType/update",
        method: "post",
        data,
    });
}

function findById(id: string): Promise<Resp<DictTypeDetailResult>> {
    return request({
        url: "/sys/dictType/findById",
        method: "get",
        params: { id },
    });
}

function page(data: DictTypePageReq): Promise<Resp<DictTypeListResult[]>> {
    return request({
        url: "/sys/dictType/page",
        method: "post",
        data,
    });
}

export const dictTypeApi = {
    create,
    findById,
    page,
    remove,
    update,
};
